home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
HAMRADIO
/
LOADPOLE.ZIP
/
COILS.BAS
next >
Wrap
BASIC Source File
|
1992-02-19
|
3KB
|
49 lines
100 'program to calculate the number of turns for an inductor.
110 cls:pi=3.1415926545
120 k=1473061.855 'mhos per square inch of area of copper
130 print " +----------------------------+"
140 print " | Inductor Design Calculator |"
150 print " | by David E. Powell, KA4KNG |"
160 print " +----------------------------+":print:print
210 input "Desired inductance in microhenries";L
220 input "Gauge or diameter of wire in inches";diameter
230 input "Diameter of coil form in inches";form
240 if diameter >= 1 then diameter = .46 / 1.1229283027^(diameter +3)
250 print:print "calculating";
260 layers=1 'Single layer starting out
500 a=diameter*layers+form 'Average coil diameter to center of thickness
505 print ".";
510 gosub 2000 'calculate the number of turns
520 if prob =1 then layers = layers+1:if layers < 100 then goto 500
530 if b > 1 then layers=layers+1:goto 500
540 if n > 9999 then print "ERROR - turns count larger than 10000":system
550 n=cint(n):b=n*diameter/layers:ltry = (0.2 * a^2 * n^2)/(3*a+9*b+10*c)
560 w.length = n*a*pi
570 'calculate the resistance of coil
580 w.area = (diameter/2)^2*pi
590 r = 1/(w.area*k)*w.length
800 'show the results
810 print:print
815 print "Overall coil diameter...... ";diameter*layers*2+form;"inches"
820 print "Average coil diameter...... ";a;"inches"
830 print "Depth of coil.............. ";layers*diameter;"inches"
840 print "Length of coil............. ";b;"inches"
850 print "Length of wire (approx).... ";int(w.length/12)"feet,";
855 print int((w.length-int(w.length))*12);"inches"
860 print "Number of layers........... ";layers
870 print "Number of turns............ ";n
880 print "Number of turns per layer.. ";n/layers
890 print "Actual inductance.......... ";ltry;"microhenries"
900 print "Coil DC resistance......... ";r;"ohms"
1000 system 'Exit the program and BASIC
2000 'subroutine to calculate the number of turns
2010 min.n=1:max.n=10000:c=layers * diameter:prob=0
2060 n=(max.n-min.n)/2+min.n
2070 b=n*diameter/layers 'length of coil
2080 ltry = (0.2 * a^2 * n^2)/(3*a+9*b+10*c)
2090 if cint(max.n) = cint(min.n) then goto 3000
2100 if min.n => 9999 then prob=1:goto 3000
2110 if ltry < L then min.n=n:goto 2060
2120 if ltry > L then max.n=n:goto 2060
3000 return